import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'
import LoginView from '@/views/LoginView.vue'
import student from '../views/student.vue'
import Layout from '../views/Layout.vue'
import AdminView from '@/views/AdminView.vue'
import LifePlace from '@/views/LifePlace.vue'
import WSCheck from '@/views/WSCheck.vue'
import WaterDianViem from '@/views/WaterDianViem.vue'
import RepairView from '@/views/RepairView.vue'
import VisitRecordView from '@/views/VisitRecordView.vue'
Vue.use(VueRouter)

const routes = [
  {
    path: '/login',
    name: 'Login',
    component: LoginView
  },
  {
    path: '/',
    name: 'Layout',
    component: Layout,
    //重定向
    // redirect: '/login',
    children:[
      {
        path: 'home',
        name: 'home',
        component: HomeView
      },
       {
        path: 'lifeplace',
        name: 'lifeplace',
        component: LifePlace
      }, 
      {
        path: 'wscheck',
        name: 'wscheck',
        component: WSCheck
      },
       {
        path: 'visit',
        name: 'visit',
        component: VisitRecordView
      },
      {
        path: 'repair',
        name: 'repair',
        component: RepairView
      },
      {
        path: 'waterdian',
        name: 'waterdian',
        component: WaterDianViem
      },
     {
        path:'student',
        name: 'student',
        component:student
      },
      {
        path: 'admin',
        name: 'admin',
        component: AdminView
      },
    ]
  },

]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
